package org.dxy.domain.event.workorder;

import org.dxy.domain.event.AggregateTypeEnum;
import org.dxy.domain.event.DomainEvent;

/**
 * 返工工单创建事件
 * <p>当返工工单被创建时发布此事件，用于触发返工相关的业务逻辑
 * 
 * @author dxy
 * @createTime 2025/12/01 10:00
 */
public record ReworkOrderCreatedEvent(
    /** 返工工单ID */
    Long reworkOrderId,
    /** 返工工单编码 */
    String reworkOrderCode,
    /** 原工单ID */
    Long originalOrderId,
    /** 产品ID */
    Long productId,
    /** 返工数量 */
    Integer reworkQuantity
) implements DomainEvent {
    
    @Override
    public Long aggregateId() {
        return reworkOrderId;
    }

    @Override
    public String aggregateType() {
        return AggregateTypeEnum.WORK_ORDER.getKey();
    }

    @Override
    public String eventType() {
        return "REWORK_ORDER_CREATED";
    }
}